package com.jp.knowledge.my.adapter;

import android.content.Context;
import android.support.annotation.NonNull;

import com.jp.knowledge.R;
import com.jp.knowledge.my.base.RecycleVAdapter;
import com.jp.knowledge.my.base.RecycleVHolder;
import com.jp.knowledge.my.model.VieCoinHistoryModel;

import java.util.List;

/**
 * @author gzejia 978862664@qq.com
 */
public class VieCoinHistoryAdapter extends RecycleVAdapter<VieCoinHistoryModel> {

    public VieCoinHistoryAdapter(Context context, @NonNull List<VieCoinHistoryModel> list) {
        super(context, list);
    }

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.item_my_vie_coin;
    }

    @Override
    public void onBind(RecycleVHolder holder, int position) {
        VieCoinHistoryModel model = getData(position);
        holder.setTextView(R.id.item_vie_coin_tv_content, model.getContent());
        holder.setTextView(R.id.item_vie_coin_tv_times, (position == 0 ?
                "已使用时长" : "") + model.getNumber() + model.getUnit());
        holder.setTextView(R.id.item_vie_coin_tv_content, model.getContent());
        holder.setTextView(R.id.item_vie_coin_tv_number,
                (model.getType() == 0 ? "-" : "+") + model.getNumber());
    }
}
